import java.util.Scanner;

public class DiagonalSum {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        double[][] matrix=new double[4][4];
        for (int row=0;row < matrix.length;row++){
            for (int col=0;col<matrix[row].length;col++){
                matrix[row][col]=input.nextDouble();
            }
        }
        System.out.println(sumMajorDiagonal(matrix));

    }

    public static double sumMajorDiagonal(double[][] m) {
        double sum = 0;
        for (int i = 0; i < m.length;i++){
            sum+=m[i][i];
        }
        return sum;
    }
}
